/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controllers;

import models.Docente;
import models.SemestreAcademico;
import play.mvc.Controller;
import play.mvc.With;

/**
 *
 * @author Administrador
 */
@With(Secure.class)
public class firstController extends Controller{
    
    static String username;
    static String periodo;
    static Docente docente;
    
    public static void dispatcher(){
        
        username=Security.connected();
        session.clear();
        docente = Docente.find("doc_vcCodigo", username).first();
        periodo=null;
        		
        SemestreAcademico semestre = new SemestreAcademico();
        semestre=SemestreAcademico.find("order by id DESC").first();
        
        String controler;
        
        if(username.equals("999999")){controler="aperturarCiclo.index";
        }else{if(semestre!=null){periodo=semestre.sem_vcNombre;
        if(username.equals("000000")){controler="dptoAcademico.extraerPeriodo";
        }else{controler="disponibilidadHoraria.disponibilidad";}}else{controler="msgPeriodo.mensaje";}}
        
        redirect(controler);
    }
    
}
